Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 온보딩 과정에서 사용자가 초대 코드를 수동으로 입력할 필요 없이, URL에 포함된 초대 코드를 자동으로 인식하여 입력 필드에 채워주는 기능을 추가합니다. 이를 위해 쿼리 파라미터를 효율적으로 처리하는 유틸리티 함수를 도입하고, 기존 카카오 로그인 로직에도 이를 적용하여 코드의 일관성을 개선했습니다. 사용자 경험을 향상시키고 개발 효율성을 높이는 데 기여합니다. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
이번 PR은 getQueryParam 유틸리티 함수를 도입하여 초대 코드를 URL에서 자동으로 읽어오는 기능을 구현한 점이 좋습니다. 이를 통해 코드 재사용성이 높아지고, 기존 카카오 로그인 로직도 개선되어 전체적인 코드 품질이 향상되었습니다. 다만, 새로 추가된 getQueryParam 함수의 안정성과 명확성을 높이기 위해 일부 개선이 필요해 보입니다. 관련하여 apps/web/src/shared/lib/url.ts 파일에 리뷰 의견을 남겼습니다.
| export const getQueryParam = ( | ||
| key: string, | ||
| search: string = window.location.search | ||
| ): string | undefined => { | ||
| const value = new URLSearchParams(search).get(key); | ||
|
|
||
| if (!value) { | ||
| return undefined; | ||
| } | ||
|
|
||
| return value; | ||
| }; |
There was a problem hiding this comment.
새로 추가된 getQueryParam 유틸리티 함수의 안정성과 명확성을 높이기 위한 개선 제안입니다.
-
window객체 접근 시점: 함수 시그니처의 기본값으로window.location.search를 사용하면, 코드가 서버사이드 렌더링(SSR) 등 브라우저가 아닌 환경에서 실행될 때window객체가 없어 에러가 발생할 수 있습니다.window객체는 함수가 호출되는 시점에, 즉 함수 본문 내에서 접근하는 것이 더 안전합니다. -
값 부재 시 처리 로직:
URLSearchParams.get()메서드는 파라미터가 없을 경우null을 반환합니다. 현재!value조건문은null뿐만 아니라 값이 비어있는 파라미터(?key=)가 전달될 때의 결과인 빈 문자열('')까지undefined로 처리하여, 의도치 않은 동작을 유발할 수 있습니다.null일 경우에만undefined를 반환하도록 명확히 하는 것이 좋습니다.
아래 제안 코드는 이 두 가지를 모두 개선합니다.
| export const getQueryParam = ( | |
| key: string, | |
| search: string = window.location.search | |
| ): string | undefined => { | |
| const value = new URLSearchParams(search).get(key); | |
| if (!value) { | |
| return undefined; | |
| } | |
| return value; | |
| }; | |
| export const getQueryParam = ( | |
| key: string, | |
| search?: string | |
| ): string | undefined => { | |
| const searchString = search ?? window.location.search; | |
| const value = new URLSearchParams(searchString).get(key); | |
| // .get()은 파라미터가 없을 때 null을 반환합니다. | |
| // null 병합 연산자(??)를 사용해 null일 경우 undefined를 반환하도록 합니다. | |
| // 이 방식은 빈 문자열('')은 그대로 유지합니다. | |
| return value ?? undefined; | |
| }; |
🛠️ 변경 사항
세부 변경 내용
inviteCode쿼리 파라미터를 조회해 초대코드 입력 인풋의defaultValue로 추가해 자동입력을 구현했습니다.getQueryParam유틸을 추가했습니다. 이와 관련해 카카오 인가코드 조회 로직도 함께 리팩토링했어요.🔍 관련 이슈
📸 스크린샷 / GIF (선택)
🔄 연관 작업